<?php

if (!defined('IN_ADMIN')) {
    exit('Access Denied');
}

$mpurl = 'admin.php?ac=message';
$list = array();
if ($_GET ['op'] == "getMessageList") {
 

    $start   = $_GET ['start'] == '' ? 0 :intval($_GET ['start']);
    
    $perpage = $_GET ['perpage'] !='' ? intval($_GET ['perpage']) : 20;
    
    $uid = intval($_GET ['uid']);
    $param = array(
            'do' => 'getMessageList',
            'format' => 'json',
            'uid' => $uid,
            'start' => $start,
            'length' => $perpage,
    );
    $content = get_api_content($_SC ['apiurl'], $param);
    $content = json_decode($content);
    $list = object_to_array($content->resultData);
   
}elseif ($_GET['op'] == 'removeMessage'){
    
    $start   = $_GET ['start'] == '' ? 0 :intval($_GET ['start']);
    $perpage = $_GET ['perpage'] !='' ? intval($_GET ['perpage']) : 20;
    
    empty($_GET['id'])  && $muid = intval($_GET['mUid']);
    isset($_GET['id'])   && $id = intval($_GET['id']);
    $uid = intval($_GET['uid']);
    
    $param = array(
            'do' => 'removeMessage',
            'format' => 'json',
            'uid' => $uid,
            'start' => $start,
            'length' => $perpage,
            'id' => $id,
            'mUid' => $muid,
    );
    
    $content = get_api_content($_SC ['apiurl'], $param);
    $content = json_decode($content);
    
   if ($content->resultData == 1) {
        $msg = "操作成功!";
        cpmessage($msg);
    }
    $msg = "操作失败，请重试一次!";
    if ($content->errorNo) {
        $msg .= "errorNo:" . $content->errorNo;
    }
    cpmessage($msg);
}elseif ($_GET['op'] == 'getMessageInfo') {
    
    $start   = $_GET ['start'] == '' ? 0 :intval($_GET ['start']);
    $perpage = $_GET ['perpage'] !='' ? intval($_GET ['perpage']) : 20;
    
    isset($_GET['mUid']) && $muid = intval($_GET['mUid']);
    $uid = intval($_GET['uid']);
    
    $param = array(
            'do' => 'getMessageInfo',
            'format' => 'json',
            'uid' => $uid,
            'start' => $start,
            'length' => $perpage,
            'mUid' => $muid,
    );
    
    $content = get_api_content($_SC ['apiurl'], $param);
    $content = json_decode($content);
    $list = object_to_array($content->resultData);
}else{
    
}




